// 缓存函数
function memorize(fn) {
    const cache = Object.create(null) //存储缓存数据的对象
    return function(...args) {
        const _args = JSON.stringify(args)
        console.log(cache)
        return cache[_args] || (cache[_args] = fn.apply(fn, args))
    }
}

let add = (a, b) => {
    return a + b
}

const addCache = memorize(add)
console.log(addCache(1, 2))
console.log(addCache(1, 2))